﻿<Serializable()> Public Class DLFields
    Inherits List(Of dsDLFields.DLFieldsDataTable)

    Public Sub New()

    End Sub

    Sub Init()
        Dim sFields() As String = {"Counterparty Name", "Counterparty BIC", "Custodian BIC", "Custodian Name", "Fund Legal Name", "Fund Display Code", "Fund", "Global Link ID", "Owner BIC", "Owner Name", "Side", "Amount Bought", "Amount Sold", "Currency Bought", "Currency Sold", "NDF Fixing Date", "NDF Fixing Date Specified", "Rate", "Value Date", "Trade Date", "Transaction ID", "Affirmation", "Audit Time", "Comments", "Created Time", "Match Description", "Match GLID", "Match GLID Specified", "SIBought", "SISold", "Trade Status", "Buy Delivery Agent", "Buy Intermediary", "Buy Receiving Agent", "Common Reference ID", "Sell Beneficiary", "Sell Delivery Agent", "Sell Intermediary", "Sell Receiving Agent", "Sender to Receiver Info"}

        For Each sField As String In sFields
            Dim dr As dsDLFields.DLFieldsRow = Me(0).NewDLFieldsRow
            dr.FieldName = sField
            dr.Index = -1
            dr.Selected = False
            Me(0).AddDLFieldsRow(dr)
        Next

    End Sub

    Public Sub PopulateListBoxes()
        'frmLoader.lbFields.Items.Clear()
        'frmLoader.lbSelectedFields.Items.Clear()

        Me(0).DefaultView.Sort = "Selected ASC, Index ASC, FieldName ASC"

        frmLoader.lbSelectedFields.DataSource = Me(0).Select("Selected = 'True'")
        frmLoader.lbSelectedFields.ValueMember = "ID"
        frmLoader.lbSelectedFields.DisplayMember = "FieldName"
        frmLoader.lbFields.DataSource = Me(0).Select("Selected = 'False'")
        frmLoader.lbFields.ValueMember = "ID"
        frmLoader.lbFields.DisplayMember = "FieldName"
        'For Each dr As dsDLFields.DLFieldsRow In Me(0)
        '    If dr.Selected Then

        '        'frmLoader.lbSelectedFields.Items.Add(dr)
        '    Else
        '        frmLoader.lbFields.Items.Add(dr)
        '    End If
        'Next

    End Sub
End Class
